<template>
  <page-header-wrapper :content="`${this.$route.query.name} - 库存盘点`">
    <a-card :bordered="false">
      <a-row :gutter="24" type="flex" justify="center">
        <a-col :order="isMobile ? 2 : 1" :md="24" :lg="24">
          <a-alert
            style="white-space: pre-wrap"
            :message="`开始盘点后： \n1. 自动锁定本店的所有商品（手机、配件等）。 \n2. 商品将暂时无法出入库、批发、调库等。\n3. 支持多人同时盘库，重复部分自动过滤。\n4. 结束盘库后，自动解除锁定。`"
            type="error"
          />
          <a-divider />
          <a-form layout="horizontal">
            <a-form-item label="盘点范围">
              <a-select placeholder="请选择" >
                <a-select-option value="1">全部商品</a-select-option>
                <a-select-option :value="item.id" v-for="item in classfyOption" :key="item.id">仅盘{{ item.name }}</a-select-option>
              </a-select>
            </a-form-item>
            <a-form-item>
              <a-button type="primary" @click="handle()">开始盘点</a-button>
            </a-form-item>
          </a-form>
          <a-divider />
        </a-col>
      </a-row>
    </a-card>
  </page-header-wrapper>
</template>
  
  <script>
import { baseMixin } from '@/store/app-mixin'
import {
  getGdClassListUsingPOST,
} from '@/api/api/shangpinguanli.ts'
export default {
  name: 'Wechat',
  mixins: [baseMixin],
  data() {
    return {
      // cropper
      preview: {},
      classfyOption:[],
      option: {
        img: '/avatar2.jpg',
        info: true,
        size: 1,
        outputType: 'jpeg',
        canScale: false,
        autoCrop: true,
        // 只有自动截图开启 宽度高度才生效
        autoCropWidth: 180,
        autoCropHeight: 180,
        fixedBox: true,
        // 开启宽度和高度比例
        fixed: true,
        fixedNumber: [1, 1],
      },
    }
  },
  mounted(){
    this.getClassifyOption()
  },
  methods: {
    getClassifyOption() {
      getGdClassListUsingPOST({...this.optionParam,classType:1})
        .then((res) => {
          this.classfyOption = res.data.list
        })
        .catch((error) => {
          this.$message.error(((error.response || {}).data || {}).msg || '请求出现错误')
        })
    },
    setavatar(url) {
      this.option.img = url
    },
    handle() {
      this.$message.warn('开发中')
    },
    refresh() {
      this.$message.warn('开发中')
    },
  },
}
</script>
  
  <style lang="less" scoped>
.avatar-upload-wrapper {
  width: 100%;
  height: 200px;
}
.ant-upload-preview {
  position: relative;
  width: 100%;
  max-width: 180px;
  margin: 0 auto;
  border-radius: 50%;
  box-shadow: 0 0 4px #ccc;
  .upload-icon {
    position: absolute;
    top: 0;
    right: 10px;
    padding: 0.5rem;
    font-size: 1.4rem;
    background: rgba(222, 221, 221, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
  }
  .mask {
    position: absolute;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.4s;
    &:hover {
      opacity: 1;
    }
    i {
      position: absolute;
      top: 50%;
      left: 50%;
      margin-top: -1rem;
      margin-left: -1rem;
      color: #d6d6d6;
      font-size: 2rem;
    }
  }
  img,
  .mask {
    width: 100%;
    max-width: 180px;
    height: 100%;
    overflow: hidden;
    border-radius: 50%;
  }
}
</style>
  